Plotting function to reduce code length + simplify. Then, short function to relabel MLS weight smoothing kernel to make visually consistent, updates are:

  • 3.0 –> 3.6
  • 4.0 –> 4.8
  • 5.0 –> 6.0
  • 6.0 –> 7.2
  • 7.0 –> 8.4
create_plot <- function(dataset, y_est, type, thresh, y_min, y_max, y_lab, add_title = TRUE) {
  plot <- dataset %>%
    ggplot(aes(x = .data[[type]], y = .data[[y_est]], fill = .data[[type]], color = .data[[type]])) +
    geom_rain(alpha = .5, rain.side = 'l',
              boxplot.args = list(color = "black", outlier.shape = NA),
              boxplot.args.pos = list(
                position = ggpp::position_dodgenudge(x = .1), width = 0.1
              )) +
    facet_grid(~study) +
    ylab(y_lab) +
    ylim(y_min,y_max)+
    theme_classic() 
  
  if (add_title) {
    plot <- plot + ggtitle(paste("Distribution by", type, "category (", thresh, "mask)"))
  }
  
  plot <- plot +
    scale_fill_manual(values = pal) +
    scale_color_manual(values = pal) +
    guides(fill = 'none', color = 'none') +
    theme(text = element_text(family = "Times New Roman"),
          axis.text = element_text(size = 12, angle = 45, hjust = 1),
          axis.title = element_text(size = 12),
          legend.text = element_text(size = 12),
          legend.title = element_text(size = 12),
          plot.title = element_text(size = 16))
}

by_sample_conmod <- function(dataset, y_est, y_min, y_max, y_lab) {
  
  # Define a function to create individual plots
  create_plot <- function(data, study) {
    ggplot(data, aes(x = con, y = .data[[y_est]], fill = con, color = con)) +
      geom_rain(alpha = .5, rain.side = 'l',
                boxplot.args = list(color = "black", outlier.shape = NA),
                boxplot.args.pos = list(
                  position = ggpp::position_dodgenudge(x = .1), width = 0.1
                )) +
      facet_grid(~model) +
      ylab(y_lab) +
      ylim(y_min,y_max)+
      theme_classic() +
      scale_fill_manual(values = pal) +
      scale_color_manual(values = pal) +
      guides(fill = 'none', color = 'none') +
      theme(text = element_text(family = "Times New Roman"),
            axis.text = element_text(size = 12, angle = 45, hjust = 1),
            axis.title = element_text(size = 12),
            legend.text = element_text(size = 12),
            legend.title = element_text(size = 12),
            plot.title = element_text(size = 16)) +
      ggtitle(study) 
  }
  
  # Create plots for each study using map
  plot_list <- purrr::map(c("mls", "ahrb", "abcd"), ~ dataset %>%
                            filter(study == .x) %>%
                            create_plot(.x))
  
  # Combine plots into a single patchwork object
  combined_plots <- wrap_plots(plotlist = plot_list)
  
  # Add patchwork annotations
  combined_plots 
}

update_mls_fwhm <- function(df) {
  df <- df %>%
    mutate(fwhm = case_when(
      fwhm == "fwhm-3.0" ~ "fwhm-3.6",
      fwhm == "fwhm-4.0" ~ "fwhm-4.8",
      fwhm == "fwhm-5.0" ~ "fwhm-6.0",
      fwhm == "fwhm-6.0" ~ "fwhm-7.2",
      fwhm == "fwhm-7.0" ~ "fwhm-8.4",
      TRUE ~ as.character(fwhm)  # if none of the conditions match, keep the original value
    ))
  return(df)
}

create_specr_plot <- function(summary_df, est_label) {
  plot_a = plot_curve(df = summary_df, ci = TRUE, desc = FALSE, legend = FALSE, null = 0)
  plot_b <- plot_choices(df = summary_df, choices = c("fwhm", "motion","contrast","model"), desc = F, null = 0) +
    labs(y = "Variables", x = paste("Ordered Specification Curve \n",est_label, "coefficient"))
  
  cowplot::plot_grid(plot_a, plot_b, ncol = 1, align = "v", axis = 'tblr',
                     labels = c('A', 'B'), rel_heights = c(1, 2),
                     label_fontfamily = "Times", label_size = 12)
}

calculate_summary_stats <- function(data, variable, est_type) {
  data %>%
    select(study, {{variable}}) %>% 
    group_by(study) %>% 
    summarise(
      "est_type" = est_type,
      "median" = median({{variable}}),
      "mean" = mean({{variable}}),
      "sd" = sd({{variable}}),
      "min" = min({{variable}}),
      "max" = max({{variable}}) 
    ) %>% 
  kbl(format = "html", 
      booktabs = TRUE) %>% 
  kable_styling(full_width = FALSE)
  
}

The packages are automatically loaded using pacman. The reported .html was last ran on the system: x86_64-apple-darwin17.0 and R version: R version 4.2.1 (2022-06-23) In the Stage 1 PCI Registered Report we are focused on Individual Continouous (intraclass correlation) and the binary/continuous group similarity (jaccard and spearman). This descriptive file includes the output information for the distribution plots, min/max/mean/median of the estimates and the spec plots for each estimate time. This report is for the between-session estimates

continuous

We stated:

Aim1: the range and distribution of median ICCs across each study (three) and analytic decision category (four) are plotted across suprathreshold task-positive and subthreshold ICCs using Rainclouds (Allen et al., 2019) and the median and standard deviation is reported in a table.

to visualize the ordered median ICCs across the 360 model permutations for suprathreshold task-positive and subthreshold ICCs, specification curve analyses are used (Simonsohn et al., 2020). Specifically, results across the 360 model permutations are reported using a specification curve to represent the range of estimated effects across the variable permutations. This consists of two panels: Panel A represents the ordered ICC coefficients and the ICC’s associated 95% confidence interval colored based on no significance (gray), negative (red) or positive (blue) significance from the Null (Null here is 0) and Panel B represents the analytic decisions from each of the four categories (see Table 1) that produced the median ICC estimates. In the main text, to compare the highest and lowest ICC’s produced by the model permutations, the 25th percentile and 75th percentile median ICC estimates from the 360 models are reported separately for suprathreshold task-positive and subthreshold activation (the specification curve for all ICC estimates for suprathreshold task-positive and subthreshold activation are provided as supplemental information).

Aim2: the range and distribution of median MSBS and MSWS across each study and analytic decision category are plotted across suprathreshold task-positive and subthreshold ICCs using Rainclouds.

two separate specification curve analyses report the ordered median MSBS and MSWS coefficients in one panel and the analytic decisions that produced the MSBS and MSWS estimates in a second panel separately for suprathreshold task-positive and subthreshold activation

group similarity

We stated:

Aim1: For each study, the coefficients are plotted to reflect the distribution and range of coefficients. Both Jaccard’s and Spearman correlation are reported separately.



1 Load data

1.1 ABCD

1.2 AHRB

1.3 MLS

1.4 combine data

2 Sample descriptives

2.1 ABCD

# ABCD NDA DATA Info
abcd_nda$subject <- abcd_nda$participant_id
abcd_nda$subject <- gsub("_", "", abcd_nda$subject)
abcd_nda$session <- abcd_nda$eventname
abcd_nda$session <- gsub('2_year_follow_up_y_arm_1', '2YearFollowUpYArm1', abcd_nda$session)
abcd_nda$session <- gsub('baseline_year_1_arm_1', 'baselineYear1Arm1', abcd_nda$session)

# subsat subjects that match final QC'd listed
abcd_nda_subset <- abcd_nda %>% 
  filter(subject %in% abcd_site13_ids$V1) %>% 
  select(!c(subjectkey,eventname))

abcd_beh$subject <- gsub("sub-", "", abcd_beh$subject)
abcd_beh_r <- abcd_beh %>% 
  filter(subject %in% abcd_site13_ids$V1)
abcd_beh_r$sample <- "ABCD"

# estimate days
abcd_days <- abcd_nda_subset %>% 
  mutate(date_r = as.Date(interview_date, format = "%m/%d/%Y")) %>% 
  group_by(subject) %>% 
  arrange(date_r) %>% 
  mutate(days_btwn_scans =  as.integer(diff(date_r))) %>% 
  select(days_btwn_scans, subject, interview_age,sex, race_ethnicity) 

colnames(abcd_days) <- c("days","subject","Age","Sex","Race")
abcd_days$sample <- "ABCD"

abcd_days <- abcd_days %>% 
  mutate(Race = case_when(
      Race == 1 ~ "White",
      Race == 2 ~ "Black",
      Race == 3 ~ "Hispanic",
      Race == 4 ~ "Asian",
      Race == 5 ~ "Other",
      TRUE ~ as.character(Race)  # if none of the conditions match, keep the original value
    ))

rm(abcd_nda,abcd_site13_ids,abcd_beh)

2.2 AHRB

ahrb_beh_r <- ahrb_beh %>% 
  filter(subject %in% ahrb_ids$V1)
ahrb_beh_r$sample <- "AHRB"

ahrb_demo_subset <- ahrb_demo %>% 
  filter(participant_id %in% ahrb_ids$V1) %>% 
  mutate(days = days_ses1toses2)
ahrb_demo_subset$sample <- "AHRB"

ahrb_demo_subset <- ahrb_demo_subset %>% 
  mutate(Race = case_when(
      race == 1 ~ "White",
      race == 2 ~ "Black",
      race == 3 ~ "Hispanic",
      race == 4 ~ "Other",
      TRUE ~ as.character(race)  # if none of the conditions match, keep the original value
    ))

rm(ahrb_demo, ahrb_ids,ahrb_beh)

2.3 mls

mls_beh_r <- mls_beh %>% 
  filter(subject %in% mls_ids$V1)
mls_beh_r$sample <- "MLS"

mls_demo_subset <- mls_demo %>% 
  filter(participant_id %in% mls_ids$V1) %>% 
  mutate(days = if_else(is.na(reward_days_ses1toses2),
                        reward_ses2toses3,reward_days_ses1toses2)
  ) %>% 
  filter(session==1) %>% 
  rename()
mls_demo_subset$sample <- "MLS"
mls_demo_subset <- mls_demo_subset %>% 
  mutate(Race = case_when(
      Race == 1 ~ "White",
      Race == 2 ~ "Black",
      Race == 13 ~ "Hispanic",
      TRUE ~ "Other"  # if none of the conditions match, keep the original value
    ))

rm(mls_demo, mls_ids, mls_beh)
dur_scans <- rbind(abcd_days %>% select(subject,days,sample) %>% unique(),
                   ahrb_demo_subset %>% rename("subject" = participant_id) %>% select(subject,days,sample),
                   mls_demo_subset %>% rename("subject" = participant_id) %>% select(subject,days,sample))

2.4 Days ses-to-ses

Plot distribution of days between scans

dur_scans %>% 
  ggplot(aes(x = subject, y = days, fill = sample, color="white")) +
  geom_bar(stat = 'identity', position = 'dodge') +
  ylab("Days between scans") +
  xlab("") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = "white") +
  theme_minimal() +
  theme(axis.text.x = element_blank(), axis.ticks.x = element_blank(), text = element_text(family = "Times New Roman")) +
  facet_grid(~sample, scales = 'free_x') +
  guides(fill = FALSE, color = FALSE, scale = "none")
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

dur_scans %>%
    group_by(sample) %>% 
    summarise(
      "Sample (N)" = n(),
      "Avg Days Between Scans" = mean(days),
      "SD Days Between Scans" = sd(days)
    ) %>% 
  kbl(format = "html", 
      booktabs = TRUE) %>% 
  kable_styling(full_width = FALSE)
sample Sample (N) Avg Days Between Scans SD Days Between Scans
ABCD 120 746.9750 78.78675
AHRB 60 419.4167 80.13660
MLS 81 1088.7037 623.50815

2.5 demographics

demo_comb <- rbind(abcd_days %>% distinct(subject, .keep_all = TRUE) %>% 
                     mutate(sample = "ABCD", Age = round(Age/12,2)) %>% 
                     select(sample, subject,Age, Sex, Race, days),
                   ahrb_demo_subset %>% 
                     mutate(sample = "AHRB", Sex = if_else(sex==0,"F","M")) %>% 
                     rename("Age"= age, "subject" = participant_id) %>% 
                     select(sample, subject,Age, Sex, Race, days),
                   mls_demo_subset %>% 
                     mutate(sample = "MLS", Age = round(if_else(is.na(reward_days_ses1toses2),
                                                                ((ScanAge * 365) + reward_ses2toses3) / 365,
                                                                ScanAge),1),
                            Sex = if_else(Sex==1,"F","M")) %>% 
                     rename("subject" = participant_id) %>% 
                     select(sample, subject,Age,Sex, Race, days) 
                   ) 


table1(~Age + factor(Sex) + factor(Race) + days | sample, data = demo_comb)
ABCD
(N=120)
AHRB
(N=60)
MLS
(N=81)
Overall
(N=261)
Age
Mean (SD) 9.79 (0.585) 19.3 (1.30) 20.7 (2.26) 15.3 (5.36)
Median [Min, Max] 9.83 [9.00, 11.0] 19.2 [17.2, 21.4] 20.2 [18.0, 26.8] 17.8 [9.00, 26.8]
factor(Sex)
F 58 (48.3%) 35 (58.3%) 31 (38.3%) 124 (47.5%)
M 62 (51.7%) 25 (41.7%) 50 (61.7%) 137 (52.5%)
factor(Race)
Asian 4 (3.3%) 0 (0%) 0 (0%) 4 (1.5%)
Black 14 (11.7%) 10 (16.7%) 2 (2.5%) 26 (10.0%)
Hispanic 8 (6.7%) 3 (5.0%) 5 (6.2%) 16 (6.1%)
Other 15 (12.5%) 5 (8.3%) 1 (1.2%) 21 (8.0%)
White 79 (65.8%) 42 (70.0%) 73 (90.1%) 194 (74.3%)
days
Mean (SD) 747 (78.8) 419 (80.1) 1090 (624) 778 (429)
Median [Min, Max] 725 [648, 1070] 391 [352, 692] 756 [332, 2970] 712 [332, 2970]

2.6 behavioral descriptives

beh_dat <- rbind(abcd_beh_r,ahrb_beh_r,mls_beh_r) %>% 
   mutate(session = gsub("baselineYear1Arm1", 1, session), session = gsub("2YearFollowUpYArm1", 2, session))
rm(abcd_beh_r,ahrb_beh_r,mls_beh_r)
beh_dat <- beh_dat %>% 
  mutate(mFD = (mFD_r1+mFD_r2)/2,
         avg_acc = (acc_r1+acc_r2)/2,
         avg_mrt = (mrt_r1+mrt_r2)/2)

# mean/sd, min, max
calculate_summary_stats(beh_dat %>% rename("study" = sample) %>% filter(session=="1"), mFD, "Ses-1: Mean FD")
study est_type median mean sd min max
ABCD Ses-1: Mean FD 0.2003136 0.2466345 0.1525539 0.0642328 0.8614701
AHRB Ses-1: Mean FD 0.1169541 0.1249398 0.0430753 0.0537253 0.2428102
MLS Ses-1: Mean FD 0.1000000 0.1026543 0.0340228 0.0400000 0.2450000
calculate_summary_stats(beh_dat %>% rename("study" = sample) %>% filter(session=="2"), mFD, "Ses-2: Mean FD")
study est_type median mean sd min max
ABCD Ses-2: Mean FD 0.1735318 0.2465256 0.2278218 0.0450003 1.2929576
AHRB Ses-2: Mean FD 0.1194774 0.1429046 0.0769877 0.0596695 0.5073195
MLS Ses-2: Mean FD 0.0850000 0.0932716 0.0334866 0.0500000 0.2050000
calculate_summary_stats(beh_dat %>% rename("study" = sample) %>% filter(session=="1"), avg_acc, 
                        "Ses-1: Avg Probe Acc %")
study est_type median mean sd min max
ABCD Ses-1: Avg Probe Acc % 0.55 0.5486667 0.0416656 0.44 0.63
AHRB Ses-1: Avg Probe Acc % 0.58 0.5718333 0.0370749 0.48 0.66
MLS Ses-1: Avg Probe Acc % 0.72 0.7166049 0.1309457 0.40 0.94
calculate_summary_stats(beh_dat %>% rename("study" = sample) %>% filter(session=="2"), avg_acc, 
                        "Ses-1: Avg Probe Acc %")
study est_type median mean sd min max
ABCD Ses-1: Avg Probe Acc % 0.57 0.5632283 0.0372866 0.440 0.63
AHRB Ses-1: Avg Probe Acc % 0.59 0.5808333 0.0302695 0.510 0.65
MLS Ses-1: Avg Probe Acc % 0.68 0.6685802 0.1208699 0.365 0.94
calculate_summary_stats(beh_dat %>% rename("study" = sample) %>% filter(session=="1"), avg_mrt, 
                        "Ses-2: Avg Probe MRT (ms)")
study est_type median mean sd min max
ABCD Ses-2: Avg Probe MRT (ms) 302.9861 306.5531 34.27911 233.4614 406.2126
AHRB Ses-2: Avg Probe MRT (ms) 296.6986 297.1392 18.47109 236.8470 337.7957
MLS Ses-2: Avg Probe MRT (ms) 200.1000 204.3228 28.93196 146.8350 268.1850
calculate_summary_stats(beh_dat %>% rename("study" = sample) %>% filter(session=="2"), avg_mrt, 
                        "Ses-2: Avg Probe MRT (ms)")
study est_type median mean sd min max
ABCD Ses-2: Avg Probe MRT (ms) 271.2750 276.1124 35.95277 214.2611 439.2922
AHRB Ses-2: Avg Probe MRT (ms) 243.0866 248.4726 21.47633 217.6078 313.2700
MLS Ses-2: Avg Probe MRT (ms) 215.5700 210.0565 30.03950 105.7750 277.4300
acc_plt <- beh_dat %>% 
  ggplot(aes(x = sample, y = avg_acc, fill = sample, color = sample)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .1), width = 0.1
            )) +
  facet_grid(~session) +
  theme_classic() +
  labs(#title = paste("Distribution of Probe Accuracy (%) Across Sample and Sessions"),
          x = "Sample", y = "Probe Acc (%)") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

mrt_plt <- beh_dat %>% 
  ggplot(aes(x = sample, y = avg_mrt, fill = sample, color = sample)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .1), width = 0.1
            )) +
  facet_grid(~session) +
  theme_classic() +
  labs(#title = "Distribution of Probe Mean RT (ms) Across Sample and Sessions",
          x = "Sample", y = "MRT (ms)") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

mfd_plt <- beh_dat %>% 
  ggplot(aes(x = sample, y = mFD, fill = sample, color = sample)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .1), width = 0.1
            )) +
  facet_grid(~session) +
  theme_classic() +
  labs(#title = "Distribution of mean Framewise-displace (mFD) Across Sample and Sessions",
          x = "Sample", y = "mFD") +
  ylim(0,1) +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

cat("Plotting A = Avg Acc; B = Avg MRT; C = MeanFD ")
## Plotting A = Avg Acc; B = Avg MRT; C = MeanFD
(acc_plt | mrt_plt | mfd_plt) + plot_annotation(tag_levels = c("A","B","C")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

3 Plot distributions

Below, running the steps to summarize the different Intraclass correlation (ICC), Mean Squared Between Subject (MSBS), Mean Square Within Subject (MSWS), and jaccard and spearman similarty for the model combinations 360 across samples

3.1 ICC

Plotting overall and for each of [four] categories

3.1.1 Subthreshold Mask

Creating rainclouds via ggrain

subset <- by_sample_conmod(icc_subthresh, y_est = "median_est", y_min =-.1, y_max=.6, y_lab = "Median ICC")
fwhm_rg = create_plot(icc_subthresh, y_est = "median_est", type = "fwhm",  thresh = "sub-threshold", 
                      y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)
motion_rg = create_plot(icc_subthresh, y_est = "median_est", type = "motion", thresh = "sub-threshold", 
                        y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)
modeltype_rg = create_plot(icc_subthresh, y_est = "median_est", type = "model", thresh = "sub-threshold",
                           y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)
contrast_rg = create_plot(icc_subthresh, y_est = "median_est", type = "con", thresh = "sub-threshold", 
                          y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)

cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for sub-threshold mask")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for sub-threshold mask
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.1.2 Suprathreshold Mask

subset <- by_sample_conmod(icc_suprathresh, y_est = "median_est", y_min=-.1, y_max=.6, y_lab = "Median ICC")
fwhm_rg = create_plot(icc_suprathresh, y_est = "median_est", type = "fwhm",  thresh = "supra-threshold", 
                      y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)
motion_rg = create_plot(icc_suprathresh, y_est = "median_est", type = "motion", thresh = "supra-threshold", 
                        y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)
modeltype_rg = create_plot(icc_suprathresh, y_est = "median_est", type = "model", thresh = "supra-threshold",
                           y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)
contrast_rg = create_plot(icc_suprathresh, y_est = "median_est", type = "con", thresh = "supra-threshold", 
                          y_min=-.1, y_max=.6, y_lab = "Median ICC", add_title=FALSE)


cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for supra-threshold mask")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for supra-threshold mask
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.1.3 Nacc avg Mask

3.1.3.2 Left

fwhm_rg = create_plot(icc_nacc, y_est = "avg_left", "fwhm","Avg Left NAcc", y_min=-.3, y_max=.6, y_lab = "ICC", add_title=FALSE)
motion_rg = create_plot(icc_nacc, y_est = "avg_left", "motion","Avg Left NAcc", y_min=-.3, y_max=.6, y_lab = "ICC", add_title=FALSE)
modeltype_rg = create_plot(icc_nacc, y_est = "avg_left", "model","Avg Left NAcc",y_min=-.3, y_max=.6, y_lab = "ICC", add_title=FALSE)
contrast_rg = create_plot(icc_nacc, y_est = "avg_left", "con","sAvg Left NAcc", y_min=-.3, y_max=.6, y_lab = "ICC", add_title=FALSE)

cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for Left NAcc")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for Left NAcc
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

3.2 MSBS

Plotting overall and for each of [four] categories

3.2.1 Subthreshold Mask

subset <- by_sample_conmod(bs_subthresh, y_est = "median_est", y_min=0, y_max=7, y_lab = "Median MSBS")
fwhm_rg = create_plot(bs_subthresh, y_est = "median_est", type = "fwhm",  thresh = "sub-threshold", 
                      y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)
motion_rg = create_plot(bs_subthresh, y_est = "median_est", type = "motion", thresh = "sub-threshold", 
                        y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)
modeltype_rg = create_plot(bs_subthresh, y_est = "median_est", type = "model", thresh = "sub-threshold",
                           y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)
contrast_rg = create_plot(bs_subthresh, y_est = "median_est", type = "con", thresh = "sub-threshold", 
                          y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)

cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for sub-threshold mask")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for sub-threshold mask
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.2.2 Suprathreshold Mask

subset <- by_sample_conmod(bs_suprathresh, y_est = "median_est", y_min=0, y_max=7, y_lab = "Median MSBS")
fwhm_rg = create_plot(bs_suprathresh, y_est = "median_est", type = "fwhm",  thresh = "supra-threshold", 
                      y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)
motion_rg = create_plot(bs_suprathresh, y_est = "median_est", type = "motion", thresh = "supra-threshold", 
                        y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)
modeltype_rg = create_plot(bs_suprathresh, y_est = "median_est", type = "model", thresh = "supra-threshold",
                           y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)
contrast_rg = create_plot(bs_suprathresh, y_est = "median_est", type = "con", thresh = "supra-threshold", 
                          y_min=0, y_max=7, y_lab = "Median MSBS", add_title=FALSE)

cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for supra-threshold mask")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for supra-threshold mask
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.3 MSWS

Plotting overall and for each of [four] categories

3.3.1 Subthreshold Mask

subset <- by_sample_conmod(ws_subthresh, y_est = "median_est", y_min=0, y_max=7, y_lab = "Median MSWS")
fwhm_rg = create_plot(ws_subthresh, y_est = "median_est", type = "fwhm",  thresh = "sub-threshold", 
                      y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)
motion_rg = create_plot(ws_subthresh, y_est = "median_est", type = "motion", thresh = "sub-threshold", 
                        y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)
modeltype_rg = create_plot(ws_subthresh, y_est = "median_est", type = "model", thresh = "sub-threshold",
                           y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)
contrast_rg = create_plot(ws_subthresh, y_est = "median_est", type = "con", thresh = "sub-threshold", 
                          y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)

cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for sub-threshold mask")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for sub-threshold mask
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.3.2 Suprathreshold Mask

subset <- by_sample_conmod(ws_suprathresh, y_est = "median_est", y_min=0, y_max=7, y_lab = "Median MSWS")
fwhm_rg = create_plot(ws_suprathresh, y_est = "median_est", type = "fwhm",  thresh = "supra-threshold", 
                      y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)
motion_rg = create_plot(ws_suprathresh, y_est = "median_est", type = "motion", thresh = "supra-threshold", 
                        y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)
modeltype_rg = create_plot(ws_suprathresh, y_est = "median_est", type = "model", thresh = "supra-threshold",
                           y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)
contrast_rg = create_plot(ws_suprathresh, y_est = "median_est", type = "con", thresh = "supra-threshold", 
                          y_min=0, y_max=7, y_lab = "Median MSWS", add_title=FALSE)

cat("Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for supra-threshold mask")
## Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast for supra-threshold mask
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.4 Similarity

3.4.1 jaccard

subset <- by_sample_conmod(similarity_df, y_est = "jaccard", y_min=0, y_max = 1, y_lab = "Jaccard")

fwhm_rg = create_plot(similarity_df, y_est = "jaccard", type = "fwhm", thresh = "Jaccard", 
                      y_min=0, y_max = 1, y_lab = "Jaccard", add_title=FALSE)
motion_rg = create_plot(similarity_df, y_est = "jaccard", type = "motion", thresh = "Jaccard", 
                        y_min=0, y_max = 1, y_lab = "Jaccard", add_title=FALSE)
modeltype_rg = create_plot(similarity_df, y_est = "jaccard", type = "model", thresh="Jaccrd", 
                           y_min=0, y_max = 1, y_lab = "Jaccard", add_title=FALSE)
contrast_rg = create_plot(similarity_df, y_est = "jaccard", type = "con", thresh = "Jaccard", 
                          y_min=0, y_max = 1, y_lab = "Jaccard", add_title=FALSE)


cat("Jaccard: Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast")
## Jaccard: Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.4.2 spearman

subset <- by_sample_conmod(similarity_df, y_est = "spearman", y_min=0, y_max = 1, y_lab = "Spearman")

fwhm_rg = create_plot(similarity_df, y_est = "spearman", type = "fwhm", thresh = "Spearman", 
                      y_min=0, y_max = 1, y_lab = "Spearman", add_title=FALSE)
motion_rg = create_plot(similarity_df, y_est = "spearman", type = "motion", thresh = "Spearman", 
                        y_min=0, y_max = 1, y_lab = "Spearman", add_title=FALSE)
modeltype_rg = create_plot(similarity_df, y_est = "spearman", type = "model", thresh="Spearman", 
                           y_min=0, y_max = 1, y_lab = "Spearman", add_title=FALSE)
contrast_rg = create_plot(similarity_df, y_est = "spearman", type = "con", thresh = "Spearman", 
                          y_min=0, y_max = 1, y_lab = "Spearman", add_title=FALSE)

cat("Spearman: Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast")
## Spearman: Plotting A = Motion; B = FWHM; C = Model Parameterization, D = Contrast
(motion_rg | fwhm_rg) / (modeltype_rg | contrast_rg) + plot_annotation(tag_levels = c("A","B","C","D")) & theme(plot.tag = element_text(size = 30, face = "bold")) 

subset

3.5 Group Cohen’s ~ ICC

cohens_sim <- gather(similarity_df, key = "Ses", value = "spearman", ses1_icc_cohensd:ses2_icc_cohensd) %>% 
  mutate(Run = case_when(
    Ses == "ses1_icc_cohensd" ~ "ses1",
    Ses == "ses_icc_cohensd" ~ "ses2",
    TRUE ~ Ses
  ))
cat("\tICC, MSBS and MSWS median, miniumum and maximum")
##  ICC, MSBS and MSWS median, miniumum and maximum
calculate_summary_stats(similarity_df, ses1_icc_cohensd, "ICC ~ Ses1 Cohen's D")
study est_type median mean sd min max
abcd ICC ~ Ses1 Cohen’s D 0.0933282 0.0434043 0.1867822 -0.4327805 0.3786406
ahrb ICC ~ Ses1 Cohen’s D 0.1723025 0.1124787 0.2548283 -0.4450425 0.5265826
mls ICC ~ Ses1 Cohen’s D 0.1213723 0.1168365 0.1887960 -0.2811225 0.4317429
calculate_summary_stats(similarity_df, ses2_icc_cohensd, "ICC ~ Ses2 Cohen's D")
study est_type median mean sd min max
abcd ICC ~ Ses2 Cohen’s D 0.0933282 0.0434043 0.1867822 -0.4327805 0.3786406
ahrb ICC ~ Ses2 Cohen’s D 0.2013921 0.1173448 0.2557813 -0.4294658 0.5289596
mls ICC ~ Ses2 Cohen’s D 0.1360693 0.1134261 0.1768921 -0.3098683 0.3929272
cohens_sim %>% ggplot(aes(x = fwhm, y = spearman, fill = fwhm, color = fwhm)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .2), width = 0.1
            )) +
  facet_grid(~study + Ses) +
  theme_classic() +
  ggtitle("Distribution by FWHM category") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

cohens_sim %>% ggplot(aes(x = con, y = spearman, fill = con, color = con)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .2), width = 0.1
            )) +
  facet_grid(~study + Ses) +
  theme_classic() +
  ggtitle("Distribution by Contrast category") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

cohens_sim %>% ggplot(aes(x = motion, y = spearman, fill = motion, color = motion)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .2), width = 0.1
            )) +
  facet_grid(~study + Ses) +
  theme_classic() +
  ggtitle("Distribution by Motion category") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

cohens_sim %>% ggplot(aes(x = model, y = spearman, fill = model, color = model)) +
  geom_rain(alpha = .5, rain.side = 'l',
            boxplot.args = list(color = "black", outlier.shape = NA),
            boxplot.args.pos = list(
              position = ggpp::position_dodgenudge(x = .2), width = 0.1
            )) +
  facet_grid(~study + Ses) +
  theme_classic() +
  ggtitle("Distribution by Model category") +
  scale_fill_manual(values = pal) +
  scale_color_manual(values = pal) +
  guides(fill = 'none', color = 'none') +
  theme(text = element_text(family = "Times New Roman"),
        axis.text = element_text(size = 12, angle = 45, hjust = 1),
        axis.title = element_text(size = 12),
        legend.text = element_text(size = 12),
        legend.title = element_text(size = 12),
        plot.title = element_text(size = 16))

4 Med/Min/Max Across Models

4.1 Subtreshold

cat("Subthreshold mask")
## Subthreshold mask
cat("\tICC, MSBS and MSWS median, miniumum and maximum")
##  ICC, MSBS and MSWS median, miniumum and maximum
calculate_summary_stats(icc_subthresh, median_est, "ICC")
study est_type median mean sd min max
abcd ICC 0.093 0.1029167 0.0485142 0.027 0.232
ahrb ICC 0.126 0.1526667 0.0878269 0.041 0.402
mls ICC 0.131 0.1435792 0.0665285 0.037 0.320
calculate_summary_stats(bs_subthresh, median_est, "MSBS")
study est_type median mean sd min max
abcd MSBS 0.4930 0.6184292 0.4884101 0.054 2.914
ahrb MSBS 0.2935 0.3897667 0.3249359 0.035 1.823
mls MSBS 0.6500 0.9994333 0.8990915 0.051 3.788
calculate_summary_stats(ws_subthresh, median_est, "MSWS")
study est_type median mean sd min max
abcd MSWS 0.3615 0.4431333 0.3209857 0.045 1.893
ahrb MSWS 0.1900 0.2336458 0.1612192 0.027 0.932
mls MSWS 0.4665 0.5977542 0.4800625 0.041 2.074

4.2 Suprathreshold

cat("Suprathreshold mask")
## Suprathreshold mask
cat("\tICC, MSBS and MSWS median, miniumum and maximum")
##  ICC, MSBS and MSWS median, miniumum and maximum
calculate_summary_stats(icc_suprathresh, median_est, "ICC")
study est_type median mean sd min max
abcd ICC 0.1435 0.1618458 0.0836302 0.031 0.352
ahrb ICC 0.2090 0.2310792 0.1277304 0.043 0.532
mls ICC 0.2055 0.2162875 0.0969472 0.058 0.473
calculate_summary_stats(bs_suprathresh, median_est, "MSBS")
study est_type median mean sd min max
abcd MSBS 0.3320 0.4144833 0.3295028 0.035 1.917
ahrb MSBS 0.1980 0.2619625 0.2168676 0.022 1.167
mls MSBS 0.4115 0.6505292 0.6058191 0.029 2.594
calculate_summary_stats(ws_suprathresh, median_est, "MSWS")
study est_type median mean sd min max
abcd MSWS 0.2315 0.2815917 0.1968913 0.030 1.161
ahrb MSWS 0.1220 0.1462708 0.0986517 0.017 0.555
mls MSWS 0.2800 0.3652458 0.2902648 0.024 1.235

4.3 simlarity

cat("Similarity median, minimum and maximum for jaccard and spearman")
## Similarity median, minimum and maximum for jaccard and spearman
calculate_summary_stats(similarity_df, jaccard, "Jaccard")
study est_type median mean sd min max
abcd Jaccard 0.2656224 0.2776756 0.1136876 0.0612830 0.5533743
ahrb Jaccard 0.3037331 0.3224565 0.1853570 0.0395941 0.7281375
mls Jaccard 0.4178440 0.4347195 0.1234524 0.1979287 0.7410373
calculate_summary_stats(similarity_df, spearman, "Spearman")
study est_type median mean sd min max
abcd Spearman 0.7970349 0.7669733 0.1380591 0.4262887 0.9526956
ahrb Spearman 0.8243898 0.7428236 0.2085670 0.3161175 0.9695884
mls Spearman 0.8712244 0.8478988 0.0910636 0.5911072 0.9723035

5 Specification Curve

Creating data in a format that is compatible with specr. Needs: estimate (i.e., ICC), std.error, conf.high, conf.low.

5.1 ICC

5.1.1 suprathreshold

5.1.1.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

# first, combine independent model vars into string to create average for each model type
icc_suprathresh$model_type <- paste(icc_suprathresh$fwhm, icc_suprathresh$motion,
                                    icc_suprathresh$con,  icc_suprathresh$model,
                                    sep = "_")

# calculate the avg estimate of ICC across study, standard error and +/- 95% confidence interval. In complete version
df_summ <- icc_suprathresh %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(median_est), std.error = sd(median_est)/sqrt(length(median_est))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "supra-threshod ICC"
create_specr_plot(df_summ, est_label)

5.1.1.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "supra-threshold ICC"
create_specr_plot(df_summ_subset, est_label)

5.1.2 subthreshold

5.1.2.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

icc_subthresh$model_type <- paste(icc_subthresh$fwhm, icc_subthresh$motion,
                                  icc_subthresh$con,  icc_subthresh$model,
                                  sep = "_")

df_summ <- icc_subthresh %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(median_est), std.error = sd(median_est)/sqrt(length(median_est))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "sub-threshold ICC"
create_specr_plot(df_summ, est_label)

5.1.2.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "sub-threshold ICC"
create_specr_plot(df_summ_subset, est_label)

5.2 MSBS

5.2.1 suprathreshold

5.2.1.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

bs_suprathresh$model_type <- paste(bs_suprathresh$fwhm, bs_suprathresh$motion,
                                   bs_suprathresh$con,  bs_suprathresh$model,
                                   sep = "_")

df_summ <- bs_suprathresh %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(median_est), std.error = sd(median_est)/sqrt(length(median_est))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "supra-threshold MSBS"
create_specr_plot(df_summ, est_label)

5.2.1.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "supra-threshold MSBS"
create_specr_plot(df_summ_subset, est_label)

5.2.2 subthreshold

5.2.2.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

bs_subthresh$model_type <- paste(bs_subthresh$fwhm, bs_subthresh$motion,
                                 bs_subthresh$con,  bs_subthresh$model,
                                 sep = "_")


df_summ <- bs_subthresh %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(median_est), std.error = sd(median_est)/sqrt(length(median_est))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "sub-threshold MSBS"
create_specr_plot(df_summ, est_label)

5.2.2.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "suprathreshold MSBS"
create_specr_plot(df_summ_subset, est_label)

5.3 MSWS

5.3.1 suprathreshold

5.3.1.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

ws_suprathresh$model_type <- paste(ws_suprathresh$fwhm, ws_suprathresh$motion,
                                   bs_suprathresh$con,  ws_suprathresh$model,
                                   sep = "_")

df_summ <- ws_suprathresh %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(median_est), std.error = sd(median_est)/sqrt(length(median_est))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "supra-threshold MSWS"
create_specr_plot(df_summ, est_label)

5.3.1.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "supra-threshold MSWS"
create_specr_plot(df_summ_subset, est_label)

5.3.2 subthreshold

5.3.2.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

ws_subthresh$model_type <- paste(ws_subthresh$fwhm, ws_subthresh$motion,
                                 ws_subthresh$con,  ws_subthresh$model,
                                 sep = "_")

# calculate the avg estimate of ICC across study, standard error and +/- 95% confidence interval. In complete version
df_summ <- ws_subthresh %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(median_est), std.error = sd(median_est)/sqrt(length(median_est))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "sub-threshold MSWS"
create_specr_plot(df_summ, est_label)

5.3.2.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subplot
est_label = "sub-threshold MSWS"
create_specr_plot(df_summ_subset, est_label)

5.4 Similarity

5.4.1 Jaccard

5.4.1.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

similarity_df$model_type <- paste(similarity_df$fwhm, similarity_df$motion,
                                  similarity_df$con, similarity_df$model,
                                  sep = "_")

df_summ <- similarity_df %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(jaccard), std.error = sd(jaccard)/sqrt(length(jaccard))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "Jaccard"
create_specr_plot(df_summ, est_label)

5.4.1.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "Jaccard"
create_specr_plot(df_summ_subset, est_label)

5.4.2 Spearman

5.4.2.1 All models

creating combined panel 1 and panel 2 for all model permutations first.

similarity_df$model_type <- paste(similarity_df$fwhm, similarity_df$motion,
                                  similarity_df$con,  similarity_df$model, 
                                  sep = "_")

# calculate the avg estimate of ICC across study, standard error and +/- 95% confidence interval. In complete version
df_summ <- similarity_df %>% 
  group_by(model_type) %>% 
  summarise(estimate = mean(spearman), std.error = sd(spearman)/sqrt(length(spearman))) %>% 
  mutate(conf.low = estimate - 1.96 * std.error, conf.high = estimate + 1.96 * std.error) %>% 
  separate(col = model_type, into = c("fwhm","motion","contrast","model"), sep = "_|-", remove = FALSE)

# plot
est_label = "Spearman"
create_specr_plot(df_summ, est_label)

5.4.2.2 subset models

Creating model that is subset to visualize reliability for the top (>75th) and bottom (< 25th) quartile

# get 75th/25th qunatiles
top_75q = as.numeric(quantile(df_summ$estimate, .75))
bot_25q = as.numeric(quantile(df_summ$estimate, .25))
df_summ_subset = df_summ %>% 
  filter(estimate < bot_25q | estimate > top_75q)

# subset plots
est_label = "Spearman"
create_specr_plot(df_summ_subset, est_label)